#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN=1e5+5;
int r[MAXN];
//bool e[MAXN];
int cnt[MAXN];
int N;
int id=1;
int ans=0;

/*
inline int fr(int n){
    int cnt=0,i=1;
    while(cnt!=n){
        if(i>N) return -1;
        if(e[i]) ++cnt;
        ++i;
    }
    return r[--i];
}*/

inline void solve(){
    int n=id;
    if(n==1) {ans= cnt[n];return;}
    for(int i=2;i<=n;++i){
        if(cnt[i-1]<=cnt[i]) cnt[i-1]=0;
        if(cnt[i-1]>cnt[i]) cnt[i-1]=cnt[i-1]-cnt[i];
        ans+=cnt[i-1];
    }
    ans+=cnt[n];

}


int main(){

    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>N;
    int tmp;
    for(int i=1;i<=N;++i){
        cin>>r[i];
        //r[tmp]++;
    }
    sort(r+1,r+1+N);
    /*for(int i=1;i<=MAXN;++i){
        if(r[i]!=0){
            cnt[id++]=r[i];
        }
        if(id-1==N) break;
    }*/
    int cur=r[1];
    for(int i;i<=N;++i){
        if(r[i]==0) continue;
        if(r[i]!=cur){
            cur=r[i];
            ++id;
        }
        cnt[id]++;
    }
    solve();
    cout<<ans;

    return 0;
}
